package com.genesis.yunnanji.view;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.genesis.yunnanji.R;
import com.genesis.yunnanji.adapter.CollectionAdapter;
import com.genesis.yunnanji.bean.CollectionBean;
import com.genesis.yunnanji.widget.RecycleViewDivider;
import com.youth.xframe.widget.XToast;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 创建日期：2018/9/30 00309:55
 * 作者：Kite
 * 描述：足迹
 */
public class UserFootprintActivity extends BaseActivity implements CollectionAdapter.OnItemClickListener {

    @BindView(R.id.rv_footprint)
    RecyclerView rvFootprint;

    private CollectionAdapter mFootprintAdapter;

    private List<CollectionBean> mFootprintBeanList = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_user_footprint;
    }

    @Override
    public void initView() {
        super.initView();
        setTitle("我的足迹");
        addMenuTextItem(R.string.clean, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mFootprintBeanList.clear();
                mFootprintAdapter.notifyDataSetChanged();
            }
        });
        getDate();
    }

    private void getDate() {
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        mFootprintBeanList.add(new CollectionBean("http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=605eff43ba0e7bec238f0be51a1e950e/b3fb43166d224f4a79fb985f0bf790529822d118.jpg",
                "云南野生菌", "吃啥补啥", "100.99"));
        rvFootprint.setLayoutManager(new LinearLayoutManager(this));
        mFootprintAdapter = new CollectionAdapter(this, mFootprintBeanList);
        rvFootprint.setAdapter(mFootprintAdapter);
        rvFootprint.setItemAnimator(new DefaultItemAnimator());
        mFootprintAdapter.setOnItemClickListener(this);
        rvFootprint.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.VERTICAL, 1, getResources().getColor(R.color.color_eee)));
    }

    @Override
    public void onItemClickListener(int pos, List<CollectionBean> myLiveList) {
        XToast.info(pos + "");
    }
}
